<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui">

    <body>
        <ui:composition template="templateGeneral.xhtml">
            <ui:define name="title">Dodavanje predmeta</ui:define>
            <ui:define name="center">

                <h2 style="margin-left: 20px"><h:outputText value="Dodavanje predmeta" /></h2>
                <h:form id="dodajPredmetForm">
                    <h:panelGrid columns="2" cellpadding="10">

                        <h:outputText value="Naziv " style="font-weight:bold"/>
                        <p:inputText    value="#{adminCtrl.noviPredmet.naziv}" required="true" requiredMessage="Morate uneti naziv"/>

                        <h:outputText value="Sifra " style="font-weight:bold"/>
                        <p:inputText   value="#{adminCtrl.noviPredmet.sifra}" required="true" requiredMessage="Morate uneti sifru"/>

                        <h:outputText value="Katedra " style="font-weight:bold"/>            
                        <p:selectOneMenu value="#{adminCtrl.selectedKatedraString}" style="min-width: 80px">
                            <p:ajax event="change" listener="#{adminCtrl.onChangeKatedra}" />
                            <f:selectItem itemLabel="Odaberi katedru" itemValue=""/>
                            <f:selectItems value="#{adminCtrl.katedreList}"/>                               
                        </p:selectOneMenu>

                        <h:outputText value="Tip " style="font-weight:bold"/>            
                        <p:selectOneMenu value="#{adminCtrl.noviPredmet.tip}">
                            <f:selectItem itemValue="Obavezni" itemLabel="Obavezni"/>
                            <f:selectItem itemValue="Izborni" itemLabel="Izborni"/>             
                        </p:selectOneMenu>

                        <h:outputText value="Fond casova " style="font-weight:bold"/>
                        <p:inputText   id="psw2" value="#{adminCtrl.noviPredmet.fondCasova}" required="true" requiredMessage="Morate uneti fond casova"/>

                        <h:outputText value="ESPB " style="font-weight:bold"/>
                        <p:inputText    value="#{adminCtrl.noviPredmet.espb}" required="true" requiredMessage="Morate uneti ESPB bodove"/>

                        <h:outputText value="Laboratorija " style="font-weight:bold"/>
                        <p:selectOneMenu value="#{adminCtrl.noviPredmet.lab}">
                            <f:selectItem itemValue="Da" itemLabel="Da"/>
                            <f:selectItem itemValue="Ne" itemLabel="Ne"/> 
                        </p:selectOneMenu>

                        <h:outputText value="Semestar " style="font-weight:bold"/>
                        <p:inputText    value="#{adminCtrl.noviPredmet.semestar}" required="true" requiredMessage="Morate uneti semestar"/>			

                        <h:outputText value="Propozicije " style="font-weight:bold"/>
                        <p:editor    value="#{adminCtrl.noviPredmet.propozicije}" />

                        <h:outputText value="Cilj i ishod " style="font-weight:bold"/>
                        <p:editor    value="#{adminCtrl.noviPredmet.cilj}" />

                        <h:outputText value="" style="font-weight:bold"/>  
                        <h:commandButton value="Dodaj" actionListener="#{adminCtrl.snimiPredmet}" />
                    </h:panelGrid>
                </h:form>

            </ui:define>
        </ui:composition>
    </body>

</html>